package com.eleadmin.ocean.service.impl;

import com.eleadmin.damon.utils.results.PageResult2;
import com.eleadmin.common.core.web.JsonResult;
import com.eleadmin.common.system.entity.User;
//import com.eleadmin.ocean.mapper.OceanBulkCargoFeeAttachMapper;
import com.eleadmin.ocean.entity.OceanBulkCargoFeeAttach;
import com.eleadmin.ocean.service.OceanBulkCargoFeeAttachService;
import org.springframework.stereotype.Service;
import com.eleadmin.ocean.biz.OceanBulkCargoFeeAttachBiz;
import net.sf.json.JSONObject;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
//import javax.transaction.Transactional;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 海运散货附加费维护服务实现类
 * @author : Doman
 * @date : 2024-08-05 17:33:17
 * @version ：1.0
 */
@Service
public class OceanBulkCargoFeeAttachServiceImpl /*extends ServiceImpl<OceanBulkCargoFeeAttachMapper, OceanBulkCargoFeeAttach> */implements OceanBulkCargoFeeAttachService {

    @Autowired
    private OceanBulkCargoFeeAttachBiz oceanBulkCargoFeeAttachBiz;

    @Override
    public JsonResult list(PageResult2<T> page, OceanBulkCargoFeeAttach oceanBulkCargoFeeAttach, User loginUser)  throws Exception{
        return oceanBulkCargoFeeAttachBiz.list(page,oceanBulkCargoFeeAttach,loginUser);
    }

    @Override
    public JsonResult list(OceanBulkCargoFeeAttach oceanBulkCargoFeeAttach, User loginUser) {
        return JsonResult.ok().setData(oceanBulkCargoFeeAttachBiz.list(oceanBulkCargoFeeAttach,loginUser));
    }

    @Override
    public JsonResult listSel(OceanBulkCargoFeeAttach oceanBulkCargoFeeAttach, User loginUser) {
        return JsonResult.ok().setData(oceanBulkCargoFeeAttachBiz.listSel(oceanBulkCargoFeeAttach,loginUser));
    }

    @Override
    public JsonResult getById(String id) {
        return JsonResult.ok().setData(oceanBulkCargoFeeAttachBiz.getById(id));
    }

    @Transactional
    @Override
    public JsonResult save(OceanBulkCargoFeeAttach oceanBulkCargoFeeAttach, User loginUser) {
        if (oceanBulkCargoFeeAttachBiz.save(oceanBulkCargoFeeAttach, loginUser)) {
            return JsonResult.ok("添加成功");
        }
        return JsonResult.error("添加失败");
    }

    @Transactional
    @Override
    public JsonResult update(OceanBulkCargoFeeAttach oceanBulkCargoFeeAttach, User loginUser) {
        if (oceanBulkCargoFeeAttachBiz.update(oceanBulkCargoFeeAttach, loginUser)) {
            return JsonResult.ok("修改成功");
        }
        return JsonResult.error("修改失败");
    }

    @Transactional
    @Override
    public JsonResult remove(String id, User loginUser) {
        if (oceanBulkCargoFeeAttachBiz.remove(id, loginUser)) {
            return JsonResult.ok("删除成功");
        }
        return JsonResult.error("删除失败");
    }

}
